<!-- END PAGE HEADER-->
<?php $this->load->view('header');?>

<div class="page-container">
    <?php $this->load->view('sidebar');?>
    <!-- BEGIN CONTENT -->
    <div class="page-content-wrapper">
        <div class="page-content">
            <div class="admin-box">
    <ul class="nav nav-tabs">
        <li class="active">
            <a href="#profile_tab" data-toggle="tab">
                 个人资料
            </a>
        </li>
        <li>
            <a href="#tracks_tab" data-toggle="tab">
                 跟踪记录
            </a>
        </li>
        <li>
            <a href="#tracks_tab2" data-toggle="tab">
                 预约记录
            </a>
        </li>
    </ul>                        

    <div class="tab-content">
        <!-- profile_tab start -->
        <div id="profile_tab" class="tab-pane active">
        	<?php echo form_open($this->uri->uri_string(), array('class'=>'form-horizontal','role'=>'form')); ?>
            <div class="form-body">
                <h3 class="form-section"><?php echo lang('clue_basic_info'); ?></h3>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><font color="red">*</font><?php echo lang('clue_student_name'); ?></label>
                            <div class="col-md-6">
                                <p class="form-control-static"><?php echo set_value('student_name', isset($clue) ? $clue->student_name : ''); ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_student_nickname'); ?></label>
                            <div class="col-md-6">
                                <p class="form-control-static"><?php echo set_value('student_nickname', isset($clue) ? $clue->student_nickname : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('grade') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_grade'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static">
                                <?php 
                                $grades = $this->config->item('comm.grade');
                                echo array_key_exists($clue->grade,$grades)?$grades[$clue->grade]:''; ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_school'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo set_value('school', isset($clue) ? $clue->school : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>
            
                 <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><font color="red">*</font><?php echo lang('clue_phone'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static"><?php echo set_value('phone', isset($clue) ? $clue->phone : ''); ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_tel'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static"><?php echo set_value('tel', isset($clue) ? $clue->tel : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_parent_name1'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static"><?php echo set_value('parent_name1', isset($clue) ? $clue->parent_name1 : ''); ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_parent_phone1'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static"><?php echo set_value('parent_phone1', isset($clue) ? $clue->parent_phone1 : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_parent_name2'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static"><?php echo set_value('parent_name2', isset($clue) ? $clue->parent_name2 : ''); ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_parent_phone2'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static"><?php echo set_value('parent_phone2', isset($clue) ? $clue->parent_phone2 : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('sex') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_sex'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo $clue->sex==0?lang('clue_sex_male'):lang('clue_sex_female')?></p>                 
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_address'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo set_value('address', isset($clue) ? $clue->address : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><font color="red">*</font><?php echo lang('clue_trade_wish'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static">
                                <?php 
                                $wishs = $this->config->item('comm.trade_wish');
                                echo $wishs[$clue->trade_wish]; ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('source') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_source'); ?></label>
                            <div class="col-md-4">
                                <p class="form-control-static">
                                <?php 
                                $sources = $this->config->item('comm.clue_source');
                                echo $clue->source?$sources[$clue->source]:'未知'; ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('from_big'); ?></label>
                             <div class="col-md-6">
                                <p class="form-control-static">
                                <?php 
                                $sources = $this->config->item('comm.from_big');
                                echo $sources[$clue->from_big]; ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <h3 class="form-section"><?php echo lang('clue_other_info'); ?></h3>

                 <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('idcard') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_idcard'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo set_value('idcard', isset($clue) ? $clue->idcard : ''); ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_birthday'); ?></label>
                            <div class="col-md-5">
                                <p class="form-control-static"><?php echo set_value('birthday', isset($clue) ? $clue->birthday : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('email') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('bf_email'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo set_value('email', isset($clue) ? $clue->email : ''); ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group">
                            <label class="control-label col-md-3" ><?php echo lang('clue_weibo'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo set_value('weibo', isset($clue) ? $clue->weibo : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>

                 <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('qq') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_qq'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo set_value('weibo', isset($clue) ? $clue->weibo : ''); ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('weixin') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_weixin'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo set_value('weixin', isset($clue) ? $clue->weixin : ''); ?></p>
                            </div>
                        </div>
                    </div>
                </div>


                <h3 class="form-section"><?php echo lang('clue_system_info'); ?></h3>

                 <div class="row">
                    <div class="col-md-6">    
                        <div class="form-group >">
                            <label class="control-label col-md-3" ><?php echo lang('clue_consultant'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo isset($clue) ? $clue->consultant['username'] : '无'; ?></p>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-6">    
                        <div class="form-group<?php echo form_error('promoter') ? ' has-error' : ''; ?>">
                            <label class="control-label col-md-3" ><?php echo lang('clue_promoter'); ?></label>
                            <div class="col-md-9">
                                <p class="form-control-static"><?php echo isset($clue) ? $clue->promoter : '无'; ?></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div> 

            <div class="form-actions fluid">
                <div class="row">
                    <div class="col-md-6">
                        <div class="col-md-offset-3 col-md-9">
                            <a href="<?php echo site_url('sale/clue_edit/'.$this->uri->segment(3));?>"  class="btn green" name="save">编辑</a>
                            <a href="<?php echo site_url('sale/clues');?>" class="btn default">取消</a>
                        </div>
                    </div>
                    <div class="col-md-6">
                    </div>
                </div>
            </div>         
        	<?php echo form_close(); ?>
        </div>
        <!-- profile_tab end -->

        <!-- tracks_tab start -->
        <div id="tracks_tab" class="tab-pane">
            <table class="table table-hover" id="tracks_table">
                <thead>
                    <tr>
                        <th class="table-checkbox"><input type="checkbox" class="group-checkable" data-set="#tracks_table .checkboxes"></th>
                        <th><?php echo lang('clue_track_title');?></th>
                        <th><?php echo lang('clue_student_name');?></th>
                        <th><?php echo lang('clue_track_content');?></th>
                        <th><?php echo lang('clue_track_result');?></th>
                        <th><?php echo lang('clue_track_date');?></th>
                        <th><?php echo lang('clue_next_track_date');?></th>
                        <th><?php echo lang('bf_actions');?></th>
                    </tr>
                </thead>
                <tbody>
                    <?php if($clue->tracks):?>
                    <?php foreach ($clue->tracks as $key => $track):?>
                    <tr>
                        <td><input type="checkbox" class="checkboxes" value="<?php echo $track->track_id;?>"></td>
                        <td><a href="<?php echo $track->student_id;?>"><?php echo $track->title;?></a></td>
                        <td><?php echo $track->student_name;?></td>
                        <td><?php echo $track->content;?></td>
                        <td><?php 
                            $result = config_item('comm.trade_result');
                        echo $result[$track->track_result];?></td>
                        <td><?php echo $track->track_date;?></td>
                        <td><?php echo $track->next_track_date;?></td>
                        <td>
                        <a href="<?php echo site_url('/sale/track_edit/'.$track->track_id);?>" class="btn btn-xs btn-default">编辑</a>
        <!--                <a href="" class="btn btn-xs btn-info clue_track_btn" data-target="#track_modal" data-toggle="modal" data-pk="<?php echo $track->student_id;?>" data-title="<?php echo $track->student_name;?>">追踪</a>
         -->                <button data-pk="<?php echo $track->track_id;?>" class="btn btn-xs btn-danger track_delete_btn">删除</button>
                        </td>
                    </tr>
                    <?php endforeach;?>
                    <?php endif;?>
                </tbody>
            </table>
        </div>
        <!-- tracks_tab end -->

         <!-- tracks_tab2 start -->
        <div id="tracks_tab2" class="tab-pane">
            预约上门记录
        </div>
        <!-- tracks_ttracks_tab2ab end -->
    </div>

</div>
        </div>
    </div>
</div>



<?php $this->load->view('footer');?>


<script>
    jQuery(document).ready(function() {
        App.init(); // initlayout and core plugins
    });
</script>


</body>
<!-- END BODY -->
</html>